<?php

declare(strict_types=1);

namespace app\admin\service\settings;

use Dengje\Pxy\BaseService;

class ClauseService extends BaseService
{
    protected $model = null;


    public function __construct()
    {
        $this->model =  new \app\common\model\ClauseModel();
    }

    public function list()
    {
        $list = $this->model->paginate(request()->get('page_size/d', 10));
        return $list;
    }

    public function detail($id)
    {
        $detail = $this->model->where('id', $id)->find();
        return $detail;
    }

    public function create($data)
    {
        $banner = $this->model->create($data);
        return $banner;
    }

    public function update($id, $data)
    {
        $data = $this->preExcludeFields($data);
        return $this->model->where('id', $id)->update($data);
    }

    public function delete($id)
    {
        $this->model->where('id', $id)->delete();
        return success('删除成功！');
    }
}
